package main

import (
	"net/rpc"
	"gxgeek.com/gxgeek/learngo/lang/rpc"
	"net"
	"log"
	"net/rpc/jsonrpc"
)

func main()  {
	rpc.Register(rpcdemo.DemoService{})
	listen, error := net.Listen("tcp", ":1234")
	if error != nil{
		panic(error)
	}

	for {
		accept, err := listen.Accept()
		if err != nil {
			log.Printf("accept error : %v",err)
			continue
		}
		go  jsonrpc.ServeConn(accept)
		
	}
}
